# -*- coding: utf-8 -*-
import json


#测试库企业证书计数
def getCompanyCertCount(request):
    request.cursor_33.execute('''
        select 
            ifnull(lx,'') lx,
            ifnull(dl,'') dl,
            ifnull(xl,'') xl,
            ifnull(zy,'') zy,
            count(*) as total
        from yb_biz_company_aptitude
        group by ifnull(lx,''),ifnull(dl,''),ifnull(xl,''),ifnull(zy,'') 
        #order by length(ifnull(lx,'')),length(ifnull(dl,'')),length(ifnull(xl,'')),length(ifnull(zy,''))
        order by total desc
    ''')
    rows = request.cursor_33.fetchall()
    return json.dumps(rows, ensure_ascii=False)